import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/page/home/home';


Vue.use(Router)

const originalPush = Router.prototype.push

Router.prototype.push = function push (location) {

    return originalPush.call(this, location).catch(err => err)

}

const router = new Router({
    routes:[
        {
            path:"/home",
            name: "home",
            component: () => import('@/page/home/home.vue')
        },
        {
            path: '/',
            name: 'loading',
            component: () => import('@/page/loading/loading.vue'),
        },
        {
            path: '/game',
            name: 'game',
            component: () => import('@/page/game/game.vue')
        }
    ]
})
router.beforeEach((to, from, next) => {
    // 登录验证
    
    next()
})

export default router